package num07;

import java.net.Inet4Address;

/**
 * 7. 整数反转
 */
class Solution {
    public int reverse(int x) {
        long res = 0;
        while (x != 0) {
            res = res * 10 + x % 10;
            x /= 10;
        }
        if (res < Integer.MIN_VALUE || res > Integer.MAX_VALUE) {
            return 0;
        }

        return Long.valueOf(res).intValue();
    }

    public static void main(String[] args) {
        System.out.println(new Solution().reverse(1534236469));
    }
}